<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>登录</title>
<link rel="stylesheet" href="<%=basePath%>/plugins/layui/css/layui.css"
	media="all" />
<link rel="stylesheet" href="<%=basePath%>/css/login.css" />
</head>



<body class="beg-login-bg">


		<div class="beg-login-box">
		<header>
		<h1>后台登录</h1>
		</header>
		<div class="beg-login-main">
			<form action="user/login" class="layui-form" method="post">
				<input name="__RequestVerificationToken" type="hidden"
					value="fkfh8D89BFqTdrE2iiSdG_L781RSRtdWOH411poVUWhxzA5MzI8es07g6KPYQh9Log-xf84pIR2RIAEkOokZL3Ee3UKmX0Jc8bW8jOdhqo81" />
				<div class="layui-form-item">
					<label class="beg-login-icon"> <i class="layui-icon">&#xe612;</i>
					</label> <input type="text" id="userName" name="userName"
						lay-verify="userName" autocomplete="off" placeholder="这里输入登录名"
						class="layui-input"> <span id="Uname"></span>
				</div>
				<div class="layui-form-item">
					<label class="beg-login-icon"> <i class="layui-icon">&#xe642;</i>
					</label> <input type="password" id="password" name="password"
						lay-verify="password" autocomplete="off" placeholder="这里输入密码"
						class="layui-input"> <span id="Upwd"></span>
				</div>
				<div class="layui-form-item">
					<div class="beg-pull-left beg-login-remember">
						<label>记住帐号？</label> <input type="checkbox" name="rememberMe"
							value="true" lay-skin="switch" checked title="记住帐号">
					</div>
					<div class="beg-pull-right">
						<!-- 
							<button class="layui-btn layui-btn-primary" lay-submit lay-filter="login">
							
                            <i class="layui-icon">&#xe650;</i> 登录
                        </button>
                         -->
						<!-- lay-submit lay-filter="login" -->
						<input id="sbm" type="button" value="登陆"
							class="layui-btn layui-btn-primary">
							

					</div>
					<div class="beg-clear"></div>
				</div>
			</form>
		</div>
		<footer>
		<p>Beginner © www.bdqn.cn</p>
		</footer>
	</div>

</body>

<script type="text/javascript"
	src="<%=basePath%>/plugins/layui/layui.js"></script>
<script type="text/javascript" src="<%=basePath%>/js/jquery-1.8.3.js"></script>
<script type="text/javascript">
	//用户名
	$(function() {
			
		function checkUser() {
			var userName = $("#userName").val();
			if (userName == "" || userName == null) {
				$("#Uname").html("用户名不能为空").css("color", "red");

			} else {
				$("#Uname").html("");

			}

		}

		//密码
		function checkword() {
			var userpwd = $("#password").val();
			if (userpwd == "" || userpwd == null) {
				$("#Upwd").html("密码不能为空").css("color", "red");
			} else {
				$("#Upwd").html("");

			}
		}

		$("#userName").blur(checkUser);
		$("#password").blur(checkword);

	});

	 $(function() {

		$('#sbm').click(function() {

			$.post("user/login", $("form").serialize(),function(result) {
				var re = /^[0-9]+.?[0-9]*$/;
				
				if (re.test(result)) {

					window.location.href = "/1and5Demo/computerinfo/show1?computerroomId="+result;
					
				} else if(result == "index"){
					window.location.href = "index.jsp";
					

				}else if(result == "index2"){
					window.location.href = "index2.jsp";
					

				}else if(result == "index4"){
					window.location.href = "index4.jsp";			
				}else{
					alert("用户名和密码错误");	
					
				}

			});

		});

	}); 6 
</script>
</html>